#ifndef __IMAGE_SOURCE_H__
#define __IMAGE_SOURCE_H__

#include "file_table.h"
#include "font_lib.h"

//----------------------------------图片素材映射表---------------------------------//
//开机动画
#define LOADING_GIF_START			0
#define LOADING_GIF_SIZE			10
#define LOADING_GIF_END				(LOADING_GIF_START + LOADING_GIF_SIZE)	// 结尾均不包含自身在内 <

//全屏背景
#define IMG_WALLPAPER				LOADING_GIF_END

//图标
#define ICON_IMG_START				(IMG_WALLPAPER + 1)
#define ICON_IMG_SIZE				18 
#define ICON_IMG_END				(ICON_IMG_START + ICON_IMG_SIZE)

//全屏刷新整图-测试
#define FULL_SCR_IMG_START			ICON_IMG_END
#define FULL_SCR_IMG_SIZE			10 
#define FULL_SCR_IMG_END			(FULL_SCR_IMG_START + FULL_SCR_IMG_SIZE)

//PD 页 GIF 图索引
#define PD_GIF_START				FULL_SCR_IMG_END
#define PD_GIF_SIZE					5 //14
#define PD_GIF_END					(PD_GIF_START + PD_GIF_SIZE)

// PP 页 GIF 图索引
#define PP_GIF_START				PD_GIF_END
#define PP_GIF_SIZE					10
#define PP_GIF_END					(PP_GIF_START + PP_GIF_SIZE)

// M0 页 GIF 图索引
#define M0_GIF_160_START			PP_GIF_END
#define M0_GIF_160_SIZE				0 //4
#define M0_GIF_181_START			(M0_GIF_160_START + M0_GIF_160_SIZE)
#define M0_GIF_181_SIZE				4
#define M0_GIF_190_START			(M0_GIF_181_START + M0_GIF_181_SIZE)
#define M0_GIF_190_SIZE				4 
#define M0_GIF_201_START			(M0_GIF_190_START + M0_GIF_190_SIZE)
#define M0_GIF_201_SIZE				3 //4 
#define M0_GIF_220_START			(M0_GIF_201_START + M0_GIF_201_SIZE)
#define M0_GIF_220_SIZE				0 //4
#define M0_GIF_260_START			(M0_GIF_220_START + M0_GIF_220_SIZE)
#define M0_GIF_260_SIZE				3 //4 

// M4 页 GIF 图索引
#define M4_GIF_320_START 			(M0_GIF_260_START + M0_GIF_260_SIZE)
#define M4_GIF_320_SIZE				3 
#define M4_GIF_341_START			(M4_GIF_320_START + M4_GIF_320_SIZE)
#define M4_GIF_341_SIZE				0 //3

//所用到的 UI 素材总个数
#define UI_IMG_MAX_NUM				(M4_GIF_341_START + M4_GIF_341_SIZE)

//----------------------------------类型声明---------------------------------//
// lvgl_img 与文件的映射
typedef struct
{
	lv_img_dsc_t *img; //图片变量
	user_file_t file; //文件名
} img_hash_t;

//----------------------------------变量声明---------------------------------//
extern img_hash_t Image_Hash_Table[UI_IMG_MAX_NUM];

/* LVGL 图片变量(相当于已加载至 SDRAM)*/
extern lv_img_dsc_t GIF_Loading[LOADING_GIF_SIZE]; //开机 LOGO 动画
extern lv_img_dsc_t IMG_Wallpaper;				   //背景图
extern lv_img_dsc_t Commit_Icon[2];				   //公共图标 Home / Back 键
extern lv_img_dsc_t Menu_Main[5];				   //主菜单- ICON
extern lv_img_dsc_t Menu_M0[6];					   //一级菜单-M0- ICON
extern lv_img_dsc_t Menu_M4[2];					   //一级菜单-M1- ICON
extern lv_img_dsc_t Menu_PP_Icon[3];			   //一级菜单-图片演示- ICON

extern lv_img_dsc_t Full_Scr_Img[FULL_SCR_IMG_SIZE]; //全屏刷新整图-测试
extern lv_img_dsc_t GIF_PD[PD_GIF_SIZE];			 //一级菜单-产品应用- GIF 素材
extern lv_img_dsc_t GIF_PP[PP_GIF_SIZE];			 //一级菜单-图片演示- GIF 素材
//extern lv_img_dsc_t GIF_M0_160[M0_GIF_160_SIZE];    //显示页-160
extern lv_img_dsc_t GIF_M0_181[M0_GIF_181_SIZE]; //显示页-181
extern lv_img_dsc_t GIF_M0_190[M0_GIF_190_SIZE]; //显示页-190
extern lv_img_dsc_t GIF_M0_201[M0_GIF_201_SIZE]; //显示页-201
//extern lv_img_dsc_t GIF_M0_220[M0_GIF_220_SIZE];    //显示页-220
extern lv_img_dsc_t GIF_M0_260[M0_GIF_260_SIZE]; //显示页-260
extern lv_img_dsc_t GIF_M4_320[M4_GIF_320_SIZE]; //显示页-320
//extern lv_img_dsc_t GIF_M4_341[M4_GIF_341_SIZE];    //显示页-341

//----------------------------------函数声明---------------------------------//
void img_hash_table_init(img_hash_t *table, uint32_t table_size);

#endif //__IMAGE_SOURCE_H__
